package com.atguigu.java4;

public class Account1 {
	
		private double balance;
		
		public  Account1(){
			
		}
		
		public   Account1(double init_balance){
				this.balance = init_balance;
		}

		public double getBalance() {
			return balance;
		}
		
		//取钱
		public void withdraw(double amt){
			//在提款方法中要判定余额是否满足。
			if(this.balance - amt < 0){
					System.out.println("您的余额不足，请重新输入。");
			}else{
			//this.balance = this.balance - amount;//太繁琐
					balance -= amt;
					System.out.println("成功取出：" + amt );
			}
	    }
				
				//存钱
		public void deposit(double amt){
			   //this.balance = this.balance + amount;
				balance += amt;
				System.out.println("成功存入：" + amt );
		}
}
